package com.situ.mall.common.mapper;

import com.situ.mall.common.entity.Member;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 闫佳宁
 * @since 2023-09-21
 */
public interface MemberMapper extends BaseMapper<Member> {
    List<Member> select(@Param("username") String username, @Param("name") String name, @Param("status") Integer status);

    @Update("update member set password = MD5('123456') where id = #{id}")
    void update(Integer id);

    @Update("update member set status = #{status} where id = #{id}")
    void update1(Member m);
@Select("select * from member where tel=#{tel}")
    Member selectByTel(String tel);
    @Insert("insert into member(tel,password,username,create_time) values(#{tel},#{pas},#{uname},#{ct})")
    void saveMember(String tel, String pas, String uname, LocalDateTime ct);

    @Update("update member set password=#{newPassword} where id=#{id}")
    void UpdatePassword(@Param("newPassword") String newPassword, @Param("id") Integer id);

    @Select("select * from member where username = #{username}")
    List<Member> selectByUsername1(String username);
}
